﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace Playbook.Core.ViewModel
{
    /// <summary>
    /// Represents a singluar library item.
    /// </summary>
    public sealed class LibraryItemViewModel : ViewModelBase
    {
        private Guid _id;
        private string _name;
        private string _fileName;
        private string _description;
        private int _fileSize;
        private string _contentType;
        private string _versionNumber;
        private DateTime _revisionDate;
        private ObservableCollection<MetadataViewModel> _metadata;

        public LibraryItemViewModel() : base() { }

        /// <summary>
        /// This library item identifier.
        /// </summary>
        public Guid ID { get { return _id; } set { _id = value; base.RaisePropertyChanged("ID"); } }

        /// <summary>
        /// Name of this library item.
        /// </summary>
        public string Name { get { return _name; } set { _name = value; base.RaisePropertyChanged("Name"); } }

        /// <summary>
        /// Filename of this library item.
        /// </summary>
        public string FileName { get { return _fileName; } set { _fileName = value; base.RaisePropertyChanged("FileName"); } }

        /// <summary>
        /// Description of this library item.
        /// </summary>
        public string Description { get { return _description; } set { _description = value; base.RaisePropertyChanged("Description"); } }

        /// <summary>
        /// The file size of this library item.
        /// </summary>
        public int FileSize { get { return _fileSize; } set { _fileSize = value; base.RaisePropertyChanged("FileSize"); } }

        /// <summary>
        /// The content type of this library item.
        /// </summary>
        public string ContentType { get { return _contentType; } set { _contentType = value; base.RaisePropertyChanged("ContentType"); } }

        /// <summary>
        /// The version number of this library item.
        /// </summary>
        public string VersionNumber { get { return _versionNumber; } set { _versionNumber = value; base.RaisePropertyChanged("VersionNumber"); } }

        /// <summary>
        /// Create date of this version of this library item.
        /// </summary>
        public DateTime RevisionDate { get { return _revisionDate; } set { _revisionDate = value; base.RaisePropertyChanged("RevisionDate"); } }

        /// <summary>
        /// Metadata associated with this library item.
        /// </summary>
        public ObservableCollection<MetadataViewModel> Metadata
        {
            get
            {
                if (_metadata == null) { _metadata = new ObservableCollection<MetadataViewModel>(); }
                return _metadata;
            }
            set
            {
                _metadata = value;
                base.RaisePropertyChanged("Metadata");
            }
        }
    }
}